package org.myspringmvc.web.servlet;

import java.util.List;

/**
 * @ClassName: HandlerExecutionChain
 * @Author: YLY
 * @Description: 处理器执行链
 * @Date: 2025/9/21
 * @Version: 1.0
 */
public class HandlerExecutionChain {

    // 处理器
    private Object handler;
    // 拦截器
    private List<HandlerInterceptor> interceptorList;
    private int interceptorIndex = -1;


    public HandlerExecutionChain() {
    }

    public HandlerExecutionChain(Object handler, List<HandlerInterceptor> interceptorList, int interceptorIndex) {
        this.handler = handler;
        this.interceptorList = interceptorList;
    }

    /**
     * 获取
     * @return handler
     */
    public Object getHandler() {
        return handler;
    }

    /**
     * 设置
     * @param handler
     */
    public void setHandler(Object handler) {
        this.handler = handler;
    }

    /**
     * 获取
     * @return interceptorList
     */
    public List<HandlerInterceptor> getInterceptorList() {
        return interceptorList;
    }

    /**
     * 设置
     * @param interceptorList
     */
    public void setInterceptorList(List<HandlerInterceptor> interceptorList) {
        this.interceptorList = interceptorList;
    }

    /**
     * 获取
     * @return interceptorIndex
     */
    public int getInterceptorIndex() {
        return interceptorIndex;
    }

    /**
     * 设置
     * @param interceptorIndex
     */
    public void setInterceptorIndex(int interceptorIndex) {
        this.interceptorIndex = interceptorIndex;
    }

    public String toString() {
        return "HandlerExecutionChain{handler = " + handler + ", interceptorList = " + interceptorList + ", interceptorIndex = " + interceptorIndex + "}";
    }
}
